home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 2000 April / MACPOWER-2000-04.ISO.7z / MACPOWER-2000-04.ISO / ODNスターターキット / Microsoft Internet 4.5 / インターネット接続ウィザード4.5 / Internet Setup / Modem Scripts / Global Village Platinum⁄Gold II / Global Village Platinum_Gold II next >
Text File  |  1999-05-24  |  9KB  |  499 lines

  1. !  Global Village Platinum/Gold II
  2. !    Author:    Kris Kreutzman
  3. !
  4. !    Copyright:    ゥ 1991-1996 Apple Computer, Inc.    All Rights Reserved.
  5. !
  6. !    revision history:
  7. !        v2.1    as shipped with the ARA 2.1
  8. !       v2.2    update CARRIER/CONNECT parsing
  9. !
  10. !  'mlts' resource info for this modem:
  11. !    byte 1 == 01 -> modem HAS built-in error correction protocols
  12. !    byte 2 == 01 -> modem HAS built-in data compression protocols
  13. !    byte 3 == 100 -> max number of chars in varstr 7
  14. !    byte 4 == 100 -> max number of chars in varstr 8
  15. !    byte 5 == 100 -> max number of chars in varstr 9
  16. !    
  17. @ORIGINATE
  18. @ANSWER
  19. !
  20. ! ---- Initial modem setup ----
  21. !
  22. ! Set serial port speed depending upon the compression flag
  23. !    A higher rate with compression on to handle expanded data from the modem
  24. !    A lower rate closer to the DCE when compression is off
  25. ifstr 5 1 "0"
  26. serreset 57600, 0, 8, 1
  27. jump 2
  28. !
  29. @LABEL 1
  30. serreset 38400, 0, 8, 1
  31. !
  32. @LABEL 2
  33. hsreset 0 0 0 0 0 0
  34. settries 0
  35. !
  36. ! Get the modem's attention
  37. !
  38. matchclr
  39. matchstr 1 3 "OK¥13¥10"
  40. write "AT¥13"
  41. matchread 30
  42. !
  43. @LABEL 3
  44. !
  45. ! Setup the modem for the following:
  46. !   Reset to factory settings
  47. !   Standard compression/reliablity
  48. !   Lock serial port speed
  49. !   Serial port hardware handshaking, turn off software handshaking
  50. !   Verbose responces and compression/protocol results
  51. !   CONNECT returns DCE speed
  52. !   Turn off answering
  53. !   Reset or return to command mode on DTR toggle (optional)
  54. !
  55. matchclr
  56. matchstr 1 4   "OK¥13¥10"
  57. matchstr 2 101 "ERROR¥13¥10"
  58. write "AT&FE0W1&D3S7=60S0=0¥13"
  59. matchread 30
  60. inctries
  61. iftries 3 101
  62. !
  63. ! Reset the Modem on setup failure
  64. !
  65. DTRClear
  66. pause 5
  67. DTRSet
  68. flush
  69. jump 3
  70. !
  71. !
  72. @LABEL 4
  73. ! Varstring 4 , reliable link protocol:
  74. !    = 0, handled by computer (ARAP)
  75. !    = 1, handled by modem (PPP)
  76. !    = 2, MNP10 protocol (Cellular protocol, no longer supported)
  77. ifstr 4 5 "1"
  78. ifstr 4 5 "2"
  79. !
  80. ! Varstring 4 == 0, turn off reliable link protocol in modem (ARAP)
  81. matchclr
  82. matchstr 1 9 "OK¥13¥10"
  83. write "AT¥¥N0¥13"
  84. matchread 30
  85. jump 101
  86. !
  87. !
  88. @LABEL 5
  89. ! Varstring 5, compression protocol:
  90. !    = 0, handled by computer 
  91. !    = 1, handled by modem
  92. ifstr 5 9 "1"
  93. !
  94. ! Varstring 5 == 0, turn off compression protocol in modem.
  95. matchclr
  96. matchstr 1 9 "OK¥13¥10"
  97. write "AT%C0¥13"
  98. matchread 30
  99. jump 101
  100. !
  101. !
  102. @LABEL 9
  103. ! Varstring 2, modem speaker:
  104. !    = 0, speaker off
  105. !    = 1, speaker on
  106. ifstr 2 13 "1"
  107. pause 5
  108. matchclr
  109. matchstr 1 13 "OK¥13¥10"
  110. write "ATM0¥13"
  111. matchread 30
  112. jump 101
  113. !
  114. ! Modem ready, wait for a call or originate a call
  115. !
  116. @LABEL 13
  117. ifANSWER 32
  118. !
  119. !
  120. ! ---- Originating a call ----
  121. !
  122. ! Varstring 6, dialing mode:
  123. !    = 0, normal dialing
  124. !    = 1, blind dialing
  125. !    = 2, manual dialing
  126. !    otherwise dial as ARA version 1.0
  127. ifstr 6 19 "0"
  128. ifstr 6 17 "1"
  129. ifstr 6 15 "2"
  130. !
  131. ! Dialing for ARA version 1.0
  132. note "Dialing ^1" 3
  133. write "ATD^3¥^^1¥13
  134. jump 32
  135. !
  136. @LABEL 15
  137. ! Display ASK dialog with message.  Goto label 107 if dialog canceled.
  138. ASK 2 "Pick up the phone & dial ^1.  When the phone rings, click OK then hang up." 107
  139. note "Manual dialing initiated" 3
  140. ! X1 to ignore dialtone & busy, D to dial, ¥^ generates data tone
  141. write "ATX1D¥^¥13"
  142. jump 32
  143. !
  144. @LABEL 17
  145. note "Dialing without tone" 3
  146. matchclr
  147. matchstr 1 19 "OK¥13¥10"
  148. ! X1 to ignore dialtone & busy
  149. write "ATX1¥13"
  150. matchread 30
  151. jump 101
  152. !
  153. !
  154. !
  155. @LABEL 19
  156. ! Display the full dialstring contained in Varstring 1
  157. note "Dialing ^1" 3
  158. !
  159. ! Varstrings 7, 8 and 9, contain dialstring fragments
  160. !    Long phone numbers may need to be split into smaller groups
  161. !    for the modem to use
  162. !
  163. ! Varstring 3:  "p" for pulse & "t" for tone dialing
  164. ! Varstring 8 == blank (dialstring in varstring 7)
  165. ! Varstring 9 == blank (dialstring in varstrings 7 & 8)
  166. ! Otherwise (dialstring in varstrings 7, 8 & 9)
  167. ! ¥^ is added to the dialstring to force the modem to generate a data tone
  168. ifstr 8 27 " "
  169. ifstr 9 24 " "
  170. !
  171. !  Write dialstring in varstrings 7, 8 & 9
  172. matchclr
  173. matchstr 1 21 "OK¥13¥10"
  174. write "ATD^3¥^^7;¥13"
  175. matchread 400
  176. jump 101
  177.  
  178. @LABEL 21
  179. matchclr
  180. matchstr 1 22 "OK¥13¥10"
  181. write "ATD^3^8;¥13"
  182. matchread 400
  183. jump 101
  184.  
  185. @LABEL 22
  186. write "ATD^3^9¥13"
  187. jump 32
  188. !
  189. !
  190. @LABEL 24
  191. !  Write dialstring in varstrings 7 & 8
  192. matchclr
  193. matchstr 1 25 "OK¥13¥10"
  194. write "ATD^3¥^^7;¥13"
  195. matchread 400
  196. jump 101
  197.  
  198. @LABEL 25
  199. write "ATD^3^8¥13"
  200. jump 32
  201. !
  202. @LABEL 27
  203. !  Write dialstring in varstring 7
  204. write "ATD^3¥^^7¥13"
  205. !
  206. !
  207. !    ---- Connection responce ----
  208. !
  209. ! The following section will parse modem responces of two types:
  210. !   1) CARRIER xxx, PROTOCOL: yyy, COMPRESSION: yyy, CONNECT xxx
  211. !   2) CONNECT xxx/yyy
  212. !
  213. @LABEL 32
  214. settries 0
  215. @LABEL 33
  216. matchclr
  217. matchstr  1 81  "RING¥13¥10"
  218. matchstr  2 102 "NO DIALTONE¥13¥10"
  219. matchstr  3 103 "NO CARRIER"
  220. matchstr  4 103 "ERROR¥13¥10"
  221. matchstr  5 104 "BUSY¥13¥10"
  222. matchstr  6 105 "NO ANSWER¥13¥10"
  223. matchstr  7 35  "CONNECT"
  224. matchstr  8 34  "CARRIER"
  225. matchstr  9 62  "PROTOCOL: LAP"
  226. matchstr 10 62  "PROTOCOL: MNP"
  227. matchstr 11 62  "PROTOCOL: ALT"
  228. matchstr 12 67  "COMPRESSION: V"
  229. matchstr 13 67  "COMPRESSION: MNP5"
  230. matchstr 14 67  "COMPRESSION: CLASS"
  231. matchread 700
  232. ifANSWER 32
  233. jump 105
  234. !
  235. !  CARRIER parsing
  236. !
  237. @LABEL 34
  238. jsr 38
  239. inctries
  240. jump 33
  241. !
  242. !  CONNECT parsing - do not parse rate if CARRIER seen
  243. !
  244. @LABEL 35
  245. iftries 1 61
  246. jsr 38
  247. jump 61
  248. !
  249. !  Parse CONNECT/CARRIER rate subroutine
  250. !    2400 and 4800 have two entries each
  251. !    to distinguish them from 24000 and 48000
  252. !
  253. @LABEL 38
  254. matchclr
  255. matchstr  1 40 "2400¥13"
  256. matchstr  2 40 "2400/"
  257. matchstr  3 41 "4800¥13"
  258. matchstr  4 41 "4800/"
  259. matchstr  5 42 "7200"
  260. matchstr  6 43 "9600"
  261. matchstr  7 44 "12000"
  262. matchstr  8 45 "14400"
  263. matchstr  9 46 "16800"
  264. matchstr 10 47 "19200"
  265. matchstr 11 48 "21600"
  266. matchstr 12 49 "24000"
  267. matchstr 13 50 "26400"
  268. matchstr 14 51 "28800"
  269. matchread 10
  270. jump 59
  271. !
  272. ! -- Connection rates --
  273. ! CommunicatingAt informs ARA of the raw modem to modem
  274. ! connection speed.
  275. !
  276. @LABEL 40
  277. note "Communicating at 2400 bps." 2
  278. CommunicatingAt 2400
  279. jump 60
  280. !
  281. @LABEL 41
  282. note "Communicating at 4800 bps." 2
  283. CommunicatingAt 4800
  284. jump 60
  285. !
  286. @LABEL 42
  287. note "Communicating at 7200 bps." 2
  288. CommunicatingAt 7200
  289. jump 60
  290. !
  291. @LABEL 43
  292. note "Communicating at 9600 bps." 2
  293. CommunicatingAt 9600
  294. jump 60
  295. !
  296. @LABEL 44
  297. note "Communicating at 12400 bps." 2
  298. CommunicatingAt 12400
  299. jump 60
  300. !
  301. @LABEL 45
  302. note "Communicating at 14400 bps." 2
  303. CommunicatingAt 14400
  304. jump 60
  305. !
  306. @LABEL 46
  307. note "Communicating at 16800 bps." 2
  308. CommunicatingAt 16800
  309. jump 60
  310. !
  311. @LABEL 47
  312. note "Communicating at 19200 bps." 2
  313. CommunicatingAt 19200
  314. jump 60
  315. !
  316. @LABEL 48
  317. note "Communicating at 21600 bps." 2
  318. CommunicatingAt 21600
  319. jump 60
  320. !
  321. @LABEL 49
  322. note "Communicating at 24000 bps." 2
  323. CommunicatingAt 24000
  324. jump 60
  325. !
  326. @LABEL 50
  327. note "Communicating at 26400 bps." 2
  328. CommunicatingAt 26400
  329. jump 60
  330. !
  331. @LABEL 51
  332. note "Communicating at 28800 bps." 2
  333. CommunicatingAt 28800
  334. jump 60
  335. !
  336. @LABEL 59
  337. note "Communicating at an unknown rate." 2
  338. !
  339. @LABEL 60
  340. return
  341. !
  342. ! Look for reliablilty and compression results 
  343. ! after the CONNECT rate.
  344. !
  345. @LABEL 61
  346. matchclr
  347. matchstr  1 63 "LAPM"
  348. matchstr  2 63 "REL"
  349. matchstr  3 63 "ARQ"
  350. matchstr  4 68 "COMP/"
  351. matchstr  5 68 "COMP¥13"
  352. matchstr  6 63 "V42/"
  353. matchstr  7 63 "V42¥13"
  354. matchstr  8 68 "V42BIS"
  355. matchstr  9 68 "V42bis"
  356. matchstr 10 63 "MNP¥13"
  357. matchstr 11 68 "MNP5"
  358. matchstr 12 70 "¥10"
  359. matchread 10
  360. jump 70
  361.  
  362. ! -- Modem error correction link negotiation --
  363. ! Userhook 2 informs ARA that a modem-to-modem error
  364. ! correcting protocol has been negotiated
  365. !
  366. !
  367. @LABEL 62
  368. note "Modem Reliable Link Established." 2
  369. userhook 2
  370. jump 33
  371. !
  372. @LABEL 63
  373. note "Modem Reliable Link Established." 2
  374. userhook 2
  375. jump 61
  376. !
  377. ! -- Compression negotiation --
  378. ! Userhook 3 informs ARA that a modem-to-modem compression
  379. ! protocol has been negotiated
  380. !
  381. @LABEL 67
  382. note "Modem Compression Established." 2
  383. userhook 3
  384. jump 33
  385. !
  386. @LABEL 68
  387. note "Modem Compression Established." 2
  388. userhook 3
  389. jump 61
  390. !
  391. !
  392. ! -- Normal exit after "CONNECT" --
  393. !
  394. !  This modem has been setup to do CTS handshaking,
  395. !  and we assume that a CTS handshaking cable is being used.
  396. !
  397. @LABEL 70
  398. ! Turn on CTS handshaking.
  399. HSReset 0 1 0 0 0 0
  400. !
  401. ifANSWER 71
  402. pause 30
  403. @LABEL 71
  404. exit 0
  405. !
  406. !
  407. ! ---- Answer calls ----
  408. !
  409. !    A RING result from the modem and in ANSWERING mode
  410. !    claims the serial port and answering the phone
  411. !
  412. @LABEL 81
  413. ifORIGINATE 32
  414. userhook 1
  415. note "Answering phone..." 2
  416. write "ATA¥13"
  417. jump 32
  418. !
  419. !
  420. ! ---- Hang up and reset modem ----
  421. !
  422. @HANGUP
  423. @LABEL 90
  424. settries 0
  425. HSReset 0 0 0 0 0 0
  426. !
  427. @LABEL 92
  428. !  Escape from data to command mode
  429. matchclr
  430. matchstr 1 96 "OK¥13¥10"
  431. write "+++"
  432. matchread 20
  433. !
  434. @LABEL 94
  435. ! Force a hangup
  436. matchclr
  437. matchstr 1 98 "NO CARRIER¥13¥10"
  438. matchstr 2 98 "OK¥13¥10"
  439. matchstr 3 98 "ERROR¥13¥10"
  440. matchstr 4 98 "0¥13¥10"
  441. write "ATH¥13"
  442. matchread 30
  443. ! Try to get control of the modem by toggling DTR
  444. DTRClear
  445. pause 5
  446. DTRSet
  447. flush
  448. !
  449. ! Try the hangup sequence three times otherwise declare and error
  450. inctries
  451. iftries 3 101
  452. jump 92
  453. !
  454. @LABEL 96
  455. ! Pause between data and command mode
  456. pause 50
  457. jump 94
  458. !
  459. !
  460. @LABEL 98
  461. ! Recall the factory settings
  462. pause 15
  463. matchclr
  464. matchstr 1 99 "OK¥13¥10"
  465. write "AT&F¥13"
  466. matchread 30
  467. jump 101
  468. !
  469. @LABEL 99
  470. exit 0
  471. !
  472. ! ---- Error messages -----
  473. !
  474. ! Modem Not Responding
  475. @LABEL 101
  476. exit -6019
  477. !
  478. ! No Dial Tone
  479. @LABEL 102
  480. exit -6020
  481. !
  482. ! No Carrier or Error
  483. @LABEL 103
  484. exit -6021
  485. !
  486. ! Busy
  487. @LABEL 104
  488. exit -6022
  489. !
  490. ! No Answer
  491. @LABEL 105
  492. exit -6023
  493. !
  494. ! User Cancellation
  495. @LABEL 107
  496. exit -6008
  497.